We are migrating the bug tracker to github Issues. This is now the preferred way to report NASM bugs.
Self-registration is disabled due to spam issue (mail gorcunov@gmail.com or hpa@zytor.com to create an account)
When passing the empty string to incbin I expect an error from incbin. However, if the "length" of the incbinned data is used in a counter of a subsequent %rep, and there is a valid -I switch with an existing directory on the NASM command line, then the %rep will receive a very large value which will cause NASM to fail with *that* error message. The problem is that the incbin error is not displayed, making it difficult to figure out the cause of the error. Here's a few test cases: test$ nasm -v NASM version 2.15.03rc1 compiled on Sep 30 2020 test$ cat test.asm label: incbin "" %rep $ - label %endrep test$ nasm test.asm test.asm:2: error: `incbin': unable to get length of file `' test$ nasm test.asm -I ../lmacros/ test.asm:3: error: `%rep' count 9223372036854775807 exceeds limit (currently 1000000) test$ cat test2.asm incbin "" test$ nasm test2.asm test2.asm:1: error: `incbin': unable to get length of file `' test$ nasm test2.asm -I ../lmacros/ test2.asm:1: error: `incbin': unexpected EOF while reading file `../lmacros/' test2.asm:1: error: `incbin': error while reading file `../lmacros/' test$ I came across this error during development of my FAT FS format script called bootimg. If the generic def _PAYLOADFILE is not set on the NASM command line it receives the default value of "" (the empty string, including quote marks). Prior to the latest commit [1] this would lead to the incbin directive receiving the empty string. An -I switch is generally needed for this script because it needs the lmacros macro collection [2]. Finally, the size of the incbin's data is used to determine the loop counter of a %rep [3] exposing this NASM bug. As reported, the incbin error is not displayed by NASM in this case. Likewise, the %error directive that is meant to notify the user about the uninitialised def is also not displayed [4]. [1]: https://hg.ulukai.org/ecm/bootimg/rev/50b2a696666a [2]: https://hg.ulukai.org/ecm/lmacros/ [3]: https://hg.ulukai.org/ecm/bootimg/file/50b2a696666a/bootimg.asm#l1298 [4]: https://hg.ulukai.org/ecm/bootimg/file/50b2a696666a/bootimg.asm#l243